package com.yueyang.sojourn.server.service.sojourn.banner;

import com.yueyang.sojourn.server.model.po.SojournBanner;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author yemingxing
 * @summary
 * @Copyright (c) 2020, Yueyang Group All Rights Reserved.
 * @since 2020-02-26
 */
@Mapper
interface SojournBannerMapper {
    int deleteByPrimaryKey(Long id);

    int insert(SojournBanner record);

    int insertSelective(SojournBanner record);

    SojournBanner selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SojournBanner record);

    int updateByPrimaryKey(SojournBanner record);

    List<SojournBanner> selectList(@Param("keyWord") String keyWord,
                                   @Param("showTimeBeginGT") Date showTimeBeginGT,
                                   @Param("showTimeBeginLT") Date showTimeBeginLT,
                                   @Param("showTimeEndGT") Date showTimeEndGT,
                                   @Param("showTimeEndLT") Date showTimeEndLT,
                                   @Param("sort") Integer sort,
                                   @Param("excludeIds") List<Long> excludeIds);

    /**
     * 检查排序值是否重复：结束时间晚于showTimeBegin 且 开始时间早于showTimeEnd
     *
     * @param sort
     * @param showTimeBegin
     * @param showTimeEnd
     * @return java.lang.Integer
     * @author yemingxing
     * @version v1
     * @since 2020-04-17
     */
    Integer selectExistsSort(@Param("sort") int sort,
                             @Param("showTimeBegin") Date showTimeBegin,
                             @Param("showTimeEnd") Date showTimeEnd);
}